package com.aviccxzx.smarthome.UserModule;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.aviccxzx.smarthome.R;
import com.aviccxzx.smarthome.base.GosUserModuleBaseActivity;
import com.aviccxzx.smarthome.netutil.app.App;
import com.aviccxzx.smarthome.utils.ChangeNameDialogUtil;


/**
 * Created by joey on 2016/10/25.
 */
public class RecommendSceneAct extends GosUserModuleBaseActivity implements View.OnClickListener {
    TextView set_name_tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setContentView(R.layout.recommend_newscene_v19);
        }else {
        }
        ((TextView) findViewById(R.id.title_tv)).setText("生成新场景");
        findViewById(R.id.ll_title_left_view).setOnClickListener(this);
        findViewById(R.id.set_name_tv).setOnClickListener(this);
        findViewById(R.id.add_newscene_btn).setOnClickListener(this);
        set_name_tv=(TextView)findViewById(R.id.set_name_tv);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_title_left_view:
                finish();
                break;
            case R.id.set_name_tv:
                //修改场景名称
                new ChangeNameDialogUtil(this,"修改场景名称",new ChangeNameDialogUtil.SureInterfance() {
                    @Override
                    public void sureTodo(String name) {
                        set_name_tv.setText(name);
                    }
                }).showSelfDialog();
                break;
            case R.id.add_newscene_btn:
                //访问接口 生成新场景
                App.getApp().showToast("新场景添加成功");
                Intent intent1=new Intent(this,MainAct.class);
                intent1.putExtra("position",1);
                startActivity(intent1);
                App.getApp().quit();
                break;
    }
    }
}
